package com.example.feign.feign;


import com.example.feign.entity.Course;
import com.example.feign.feign.fallback.CourseFallback;
import com.example.feign.util.Response;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(value = "BASE-SERVICE",fallback = CourseFallback.class)
public interface CourseFeign {

    @RequestMapping(
            value = "/course/get",
            method = RequestMethod.GET,
            consumes = "application/json")
    public Response getCourse(@RequestParam(value = "page",required = false) Integer page,
                              @RequestParam(value = "size",required = false) Integer size,
                              @RequestParam(value = "spId",required = true) String spId,
                              @RequestParam Map map);

    @RequestMapping(
            value = "/course/getAll",
            method = RequestMethod.GET,
            consumes = "application/json")
    public Response getAllCourse();

    @RequestMapping(value = "/course/add",method = RequestMethod.POST)
    public Response addCourse(@RequestBody Course course);

    @RequestMapping(value = "/course/update",method = RequestMethod.PUT)
    public Response updateCourse(@RequestBody Course course);

    @RequestMapping(value = "/course/del",method = RequestMethod.PUT)
    public Response delCourse(@RequestParam(value = "courseId", required = true) String courseId);
}
